﻿@model DingTalkAgent.Model.Admin_Info
@{
    ViewBag.Title = "Edit";
    Layout = null;
}

<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
    <h4 class="modal-title">管理员修改</h4>
</div>

<div class="modal-body">
    @using (Html.BeginForm("Edit", "AdminInfo", FormMethod.Post, new { id = "form_Edit", name = "form_Edit" }))
            {
        <table class="table">

            <tr>
                <th>
                    <span class="must">*</span>账号：
                </th>
                <td>
                    @Html.TextBoxFor(model => model.account, new { @class = "form-control" })
                    @Html.HiddenFor(model => model.ID)
                    <div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    <span class="must">*</span>密码：
                </th>
                <td>
                    @Html.TextBoxFor(model => model.password, new { @class = "form-control" })
                    <div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    <span class="must">*</span>角色：
                </th>
                <td>
                    @Html.DropDownList("RoleID", Model.Rolelist)
                    <div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    <span class="must">*</span>姓名：
                </th>
                <td>
                    @Html.TextBoxFor(model => model.Name, new { @class = "form-control" })
                    <div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    <span class="must">*</span>电话：
                </th>
                <td>
                    @Html.TextBoxFor(model => model.Phone, new { @class = "form-control" })
                    <div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    备注：
                </th>
                <td>
                    @Html.TextAreaFor(model => model.Remark, new { @class = "form-control" })
                    <div>
                    </div>
                </td>
            </tr>
        </table>
    }
    <div class="remark">
        <h4 class="remark_tit">
            温馨提示
        </h4>
        <div class="remark_content">
            <p>
                <span class="must">*</span>项必须填写。
            </p>
        </div>
    </div>
</div>

<div class="modal-footer">
    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
    <button type="button" class="btn btn-primary" id="Edit">保存</button>
</div>


<script type="text/javascript">
    var Validater;

    $(document).ready(function () {

        //验证
        Validater = $("form").validate({
            rules: {
                account: {
                    required: true,
                    rangelength: [1, 32]
                },
                password: {
                    required: true,
                    rangelength: [6, 15]
                },
                Phone: {
                    required: true,
                    rangelength: [1, 11]
                },
                Name: {
                    required: true,
                    rangelength: [1, 32]
                }
            },
            messages: {}
        });
        $("#Edit").click(function () {
            if (Validater.form()) {
                SetData("/AdminInfo/Edit","修改成功");
            }
        });

    });
</script>
